<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="jquery/jquery.min.js"></script>

    <script>
        $(function () {

            $('#btn1').click(function () {
                //查询单个
                $.get("/employees/2",function (data) {
                    console.log(data);
                })
            });
            $('#btn2').click(function () {
                //查询多个
                $.get("/employees",function (data) {
                    console.log(data);
                })
            });
            $('#btn3').click(function () {
                //添加单个--使用POST方式
              $.post("/employees",{name:"大熊",age:37},function (data) {
                  console.log(data);
              })

            });
            $('#btn4').click(function () {
                //删除单个
                $.ajax({
                   url:"/employees",
                   type:"DELETE",
                    data:{id:1},
                   success:function (date) {
                       console.log(date);
                   }
                });

            });
            $('#btn5').click(function () {
                //修改单个
                $.ajax({
                    url:"/employees",
                    type:"PUT",
                    data:{id:77,name:"菲菲",age:98},
                    success:function (date) {
                        console.log(date);
                    }
                });
            });
        });
    </script>
</head>

<body>

    <button id="btn1">查询单个</button>
    <button id="btn2">查询多个</button>
    <button id="btn3">添加单个</button>
    <button id="btn4">删除单个</button>
    <button id="btn5">修改单个</button>

</body>
</html>